load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"

location_f="/Users/ivana/WORK_BSC/final_figures_allmodels/ecearth3.2/"

fc    = addfile(location_f + "columnnet_ano_zonal_ecearth3p.nc", "r")

ano=fc->ZONAL_ANN_COLUMN_NET_ANO
lat=fc->lat
ano!0 = "lat"
ano@lat2d = fc->lat


rad  = 4.0 * atan(1.0) / 180.
clat=dble2flt(cos(lat(:,0)*rad))

ano=ano*clat
printVarSummary(ano)
printVarSummary(lat)
;****************************************
; Create plot
;****************************************
wks = gsn_open_wks("pdf","zonal_columnnetflux_ecearth3p")

   plot    = new (1,"graphic")

   res                      = True          ; individual plot
   res@gsnDraw              = False
   res@gsnFrame             = False
   res@xyLineThicknessF     = 2.0
   res@xyMonoLineColor         =True
   res@xyLineColor         = "black"
   res@gsnYRefLine           = 0.0             ; create a reference line
   res@gsnAboveYRefLineColor = "red"              ; above ref line fill red
   res@gsnBelowYRefLineColor = "blue"             ; below ref line fill blue

   res@xyDashPattern        = 0                  ; Make curves all solid

   res@vpHeightF= 0.4                    ; change aspect ratio of plot
   res@vpWidthF = 0.8

   res@trYMinF=-1
   res@trYMaxF=1.5

   res@tiXAxisFontHeightF = 0.010
   res@tiYAxisFontHeightF = 0.015

   res@gsnLeftString = ""
   res@tiYAxisString = "TOA net flux ano"
   res@tiXAxisString = ""

   plot(0)  = gsn_csm_xy (wks,lat(:,0),ano,res)

;***** make panel *****


   resP                     = True          ; panel resources
   resP@gsnMaximize         = True

   resP@txFontHeightF = 0.015
   gsn_panel(wks,plot,(/1,1/),resP)

